# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=lksctp-tools
pkgver=1.0.18
pkgrel=1
pkgdesc="User-space access to Linux Kernel SCTP"
url="http://lksctp.sourceforge.net"
arch="all"
options="!check"  # sctp_connectx in v4test fails on kernel 4.14
license="GPL-2.0-only AND LGPL-2.1-or-later"
makedepends="libtool automake autoconf linux-headers"
subpackages="$pkgname-static $pkgname-dev $pkgname-doc lib${pkgname%-tools}:libs"
source="$pkgname-$pkgver.tar.gz::https://github.com/sctp/$pkgname/archive/v$pkgver.tar.gz
	header-install.patch
	"

prepare() {
	cd "$builddir"
	default_prepare
	if ! [ -e configure ]; then
		./bootstrap
	fi
}

build() {
	cd "$builddir"
	./configure \
		--prefix=/usr
	make
}

check() {
	cd "$builddir"/src/func_tests
	make v4test
	make v6test
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install
}

libs() {
	default_libs
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/lksctp-tools "$subpkgdir"/usr/lib
}

sha512sums="1d7275fadc0f2270865307cff2645810e9bab6c1a97e70be6115cace737334dbdd87a072fae25b89dd9cac2e05974556542de70ea8ef70b9e4f14873c82a5055  lksctp-tools-1.0.18.tar.gz
0f26eba03b163e7f3d5dd9760e01734547603a69fb1fe93826c68503b13a175f7f848f9cfbcf79d5509823219c637c3155988a2ae29b080c508ee22b48da28f8  header-install.patch"
